<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>

<%@ page import="com.msmall.base.util.ConstantDB" language="java"%>
<c:set var="SEGMENT_ID_COOKBOOK_MOTHER_NAV" value="<%=ConstantDB.SEGMENT_ID_COOKBOOK_MOTHER_NAV%>"></c:set>
<c:set var="SEGMENT_ID_COOKBOOK_BABY_NAV" value="<%=ConstantDB.SEGMENT_ID_COOKBOOK_BABY_NAV%>"></c:set>

<div class="que_module martop10">
<c:set var="parent" value="${current.firstParent}"></c:set>
	<div class="k_listleft">
		<p class="k_listleftnav sH705">热文推荐</p>
		<tiles:insertDefinition name="html.klg.hot.image"></tiles:insertDefinition>
	</div>
	<div class="w520 fl">
		<div>
			<div id="cookbookTabs" class="qlistquesnav">
				<c:forEach var="segment" items="${parent.children}" varStatus="status1">
					<c:choose>
						<c:when test="${segment.current.segmentid == SEGMENT_ID_COOKBOOK_MOTHER_NAV}">
							<p id="cookbookMotherTabs-${segment.current.segmentid}" class=""><c:out value='${segment.current.title}'/></p>
						</c:when>
						<c:when test="${segment.current.segmentid == SEGMENT_ID_COOKBOOK_BABY_NAV}">
							<p id="cookbookBabyTabs-${segment.current.segmentid}" class=""><c:out value='${segment.current.title}'/></p>
						</c:when>
					</c:choose>
				</c:forEach>
			</div>
		</div>
		<div id="cookbookTabsContent">
		</div>
	</div>
	<div class="w250 fr">
		<tiles:insertDefinition name="html.wiki.index.bbs"></tiles:insertDefinition>
		<tiles:insertDefinition name="html.wiki.index.klg"></tiles:insertDefinition>
	</div>
</div>

<script>
$.each($("#cookbookTabs p"),function(i, n){
	n.onmouseover=function(){
		var pid=$(this).attr('id');
		var ids = pid.split('-');
		this.timer=window.setTimeout(function(){
		$("#cookbookTabs p").removeClass("qlistquesnavbg").addClass("");
		n.className="qlistquesnavbg";
		fetchCookbookList(ids[1],1);
		},100);
	};
	n.onmouseout=function(){window.clearTimeout(this.timer);}
});
$("#cookbookTabs p:first").mouseover(); 

function fetchCookbookList(segid, pageIndex){
	$.ajax({
		type : "POST",
		url : '<c:url value="/cookbook/fetch.do"/>',
		data : "segid="+segid+"&pi="+pageIndex,
		dataType:"html", 
		timeout:20000,
		success : function(data){
			$("#cookbookTabsContent").html(data);
		},
		error: function(){
		}
	});
}
</script>
